<template>
  <div class="animation-wrapper">
    <div class="key-lock-animation">
      <div class="lock">
        <div class="lock-body"></div>
        <div class="lock-hook"></div>
        <div class="lock-base"></div>
      </div>
      <div class="key">
        <div class="key-head"></div>
        <div class="key-shaft"></div>
        <div class="key-teeth"></div>
      </div>
      <div class="reset-text">重置密码</div>
      <div class="sparkles">
        <div class="sparkle sparkle-1"></div>
        <div class="sparkle sparkle-2"></div>
        <div class="sparkle sparkle-3"></div>
        <div class="sparkle sparkle-4"></div>
        <div class="sparkle sparkle-5"></div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ForgetAnimation'
}
</script>

<style scoped>
.animation-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.key-lock-animation {
  width: 220px;
  height: 220px;
  position: relative;
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-15px);
  }
  100% {
    transform: translateY(0px);
  }
}

.lock {
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
}

.lock-body {
  width: 80px;
  height: 60px;
  background: #D1C4E9;
  border-radius: 8px;
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  }
  50% {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  }
  100% {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  }
}

.lock-hook {
  width: 40px;
  height: 40px;
  border: 8px solid #9575CD;
  border-radius: 40px 40px 0 0;
  border-bottom: none;
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 0;
  animation: hookMove 4s ease-in-out infinite;
}

@keyframes hookMove {
  0%, 20%, 100% {
    transform: translateX(-50%) scaleY(1);
  }
  40%, 80% {
    transform: translateX(-50%) scaleY(0.7);
  }
}

.lock-base {
  width: 20px;
  height: 20px;
  background: #7E57C2;
  border-radius: 50%;
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  animation: glow 4s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(126, 87, 194, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(126, 87, 194, 0.8);
  }
}

.key {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-80px) rotate(0deg);
  transform-origin: 50% 10%;
  animation: keyMove 4s ease-in-out infinite;
}

@keyframes keyMove {
  0%, 100% {
    transform: translateX(-80px) rotate(0deg);
  }
  25% {
    transform: translateX(-40px) rotate(10deg);
  }
  50% {
    transform: translateX(0px) rotate(0deg);
  }
  75% {
    transform: translateX(-40px) rotate(-10deg);
  }
}

.key-head {
  width: 30px;
  height: 30px;
  border: 5px solid #7E57C2;
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
}

.key-shaft {
  width: 5px;
  height: 80px;
  background: #7E57C2;
  position: absolute;
  top: 30px;
  left: 12.5px;
}

.key-teeth {
  position: absolute;
  top: 60px;
  left: 17.5px;
}

.key-teeth::before {
  content: '';
  position: absolute;
  width: 15px;
  height: 8px;
  background: #7E57C2;
  top: 0;
  left: 0;
}

.key-teeth::after {
  content: '';
  position: absolute;
  width: 15px;
  height: 8px;
  background: #7E57C2;
  top: 20px;
  left: 0;
}

.reset-text {
  position: absolute;
  width: 100%;
  text-align: center;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  bottom: 20px;
  left: 0;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  opacity: 0.9;
}

.sparkles {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  opacity: 0;
}

.sparkle-1 {
  top: 30%;
  left: 20%;
  animation: sparkle 3s ease-in-out infinite 0s;
}

.sparkle-2 {
  top: 60%;
  left: 80%;
  animation: sparkle 3s ease-in-out infinite 0.6s;
}

.sparkle-3 {
  top: 20%;
  left: 70%;
  animation: sparkle 3s ease-in-out infinite 1.2s;
}

.sparkle-4 {
  top: 80%;
  left: 40%;
  animation: sparkle 3s ease-in-out infinite 1.8s;
}

.sparkle-5 {
  top: 40%;
  left: 60%;
  animation: sparkle 3s ease-in-out infinite 2.4s;
}

@keyframes sparkle {
  0%, 100% {
    opacity: 0;
    transform: scale(0);
  }
  50% {
    opacity: 1;
    transform: scale(1.5);
  }
}
</style> 